package com.cn.yang.controller;

import com.alibaba.fastjson.JSONObject;
import com.cn.yang.bean.CodeManage;
import com.cn.yang.service.CodeManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/")
public class CodeController {
    @Autowired
    CodeManageService codeManageService;
    @RequestMapping("/selectCodeType")
    public JSONObject selectCodeType(@RequestBody CodeManage codeManage){
        String codeType = codeManage.getCodeType();
        codeType = codeType.equals("personnelType")?"personnel_type":codeType;
        List<CodeManage> list = codeManageService.selectCodeType(codeType);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list",list);
        return jsonObject;
    }
}
